package cn.zhuama.basic.query;

import lombok.Data;

import java.lang.annotation.Retention;

@Data
public class BaseQuery {
    //当前页
    private Integer currentPage = 1;
    //每一页显示的条数
    private Integer pageSize = 5;
    //高级查询
    private  String keyword;

    //根据当前页和每页显示的数据计算limit的第一个参数 = 当前的起始下标
    /*
    * select * from table limit startCount,pageSize
    * startCount = (当前页-1)*pageSize
    * select * from table limit 0,5     1页
    *
    * select * from table limit 5,5      2页
    *
    * select * from table limit #{begin},#{pageSize}      2页
    * */
    public Integer getBegin(){   //手动写的一个Bean属性    读
        return (this.currentPage - 1) * this.pageSize;
    }

}
//@Data
//public class BaseQuery{
//    private Integer currentpage = 1;
//    private  Integer pageSize = 5;
//    public  Integer getBegin(){
//        return (this.currentpage-1)*this.pageSize;
//    }
//}